<template>
  <div class="box">
    <div class="header">
      <header-1></header-1>
    </div>
    <div class="content">
      <dao-hang></dao-hang>
      <!-- 面包屑 -->
      <el-breadcrumb separator="/" class="mbx">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>全部手机</el-breadcrumb-item>
      </el-breadcrumb>
      <!-- 分类 -->
      <div class="Classification">
        <ul class="list">
          <li class="bt">分类：</li>
          <el-link type="primary"><li>全部</li></el-link>
          <el-link type="primary"><li>红米手机</li></el-link>
          <el-link type="primary"><li>小米手机</li></el-link>
        </ul>
      </div>
      <!-- main -->
      <div class="main">
        <div class="top">
          <!-- 排序项 -->
          <ul class="condition">
            <li v-for="item in sortList" @click="mySort(item)">
              {{ item.text }}
              <label v-if="item.text === '价格'">
                <label v-if="item.s">↑</label>
                <label v-else>↓</label>
              </label>
            </li>
          </ul>

          <div class="r">
            <!-- 收货地 -->
            <div class="address">
              <div class="block">
                <span class="demonstration">收货地</span>
                <el-cascader
                  v-model="value"
                  :options="options"
                  :props="{ expandTrigger: 'hover' }"
                  @change="handleChange"
                ></el-cascader>
              </div>
              <!-- 多选 -->
              <el-checkbox-group v-model="checkList" class="dx">
                <el-checkbox label="Promotion">促销</el-checkbox>
                <el-checkbox label="staging">分期</el-checkbox>
                <el-checkbox label="only">仅看有货</el-checkbox>
              </el-checkbox-group>
            </div>
          </div>
        </div>

        <!-- 商品列表 -->
        <div class="prodList" style="clear: both">
          <ul class="pList">
            <li v-for="prod in productList">
              <div class="img">
                <img :src="prod.imgUrl" alt="" />
              </div>
              <p class="pName">{{ prod.name }}</p>
              <p class="pPrice">{{ prod.price }}<label>元</label></p>
              <div>
                <a href="">查看详情</a>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Header1 from "../components/Header1.vue";
import DaoHang from "../components/DaoHang.vue";

export default {
  data() {
    return {
      sortList: [
        { text: "综合", s: true },
        { text: "新品", s: true },
        { text: "销量", s: true },
        { text: "价格", s: true },
      ],
      productList: [
        {
          id: 0,
          name: "小米14",
          price: 2599,
          imgUrl: require("@/assets/img/1.jpg"),
        },
        {
          id: 0,
          name: "小米14",
          price: 2300,
          imgUrl: require("@/assets/img/1.jpg"),
        },
      ],
      checkList: [], // 多选框选择的内容
      value: [], // 选择框选择的值
      options: [
        // 选择框数据
        {
          value: "beijing",
          label: "北京",
          children: [
            {
              value: "beijingshi",
              label: "北京市",
            },
          ],
        },
      ],
    };
  },
  components: {
    Header1,
    DaoHang,
  },
  methods: {
    handleChange: function () {
      // 当选中节点发生变化时触发
    },
    mySort: function (item) {
      item.s = !item.s;
    },
  },
};
</script>

<style scoped>
.box {
  margin: 0 auto;
}
.header {
  background-color: #545c64;
}
.content {
  width: 1500px;
  margin: 0 auto;
}
.mbx {
  background-color: rgb(245, 245, 245);
  line-height: 40px;
  padding-left: 30px;
}
.main {
  background-color: rgb(245, 245, 245);
}
.Classification .list {
  line-height: 80px;
}
.bt {
  font-size: large;
}
.Classification .list li {
  float: left;
  width: 150px;
  text-align: center;
}
.top {
  line-height: 60px;
}
.condition {
  margin-top: 10px;
}
.condition li {
  border-right: 1px solid rgb(221, 221, 221);
  float: left;
  width: 80px;
  text-align: center;
}
.condition li:last-child {
  border: none;
}
.condition li:hover {
  color: rgb(255, 124, 41);
  cursor: pointer;
}
.r {
  float: right;
}
.block {
  float: left;
  margin-right: 15px;
}
.dx {
  float: left;
}
.pList {
  text-align: center;
}
.pList li {
  float: left;
  width: 367px;
  height: 400px;
  padding-top: 100px;
  margin-right: 8px;
  background-color: #999;
  box-shadow: 5px 10px 15px gray;
  margin-bottom: 15px;
}
.pList li:last-child {
  margin: 0;
}
.pList li:hover {
  box-shadow: 5px 10px 5px gray;
  cursor: pointer;
}
.pList li p {
  line-height: 30px;
}
</style>
